<!-- HTML header for doxygen 1.8.3.1-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.3.1"/>
<title>Sifteo SDK: Macros</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-style-overrides.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<center>
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Sifteo SDK" src="sdk_logo.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">
   &#160;<span id="projectnumber">v1.0.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
</center>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.3.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Home</span></a></li>
      <li><a href="pages.html"><span>Guides</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Reference</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#define-members">Macros</a>  </div>
  <div class="headertitle">
<div class="title">Macros</div>  </div>
</div><!--header-->
<div class="contents">

<p>Utility, logging, and scripting macros.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:gaa1dec568e79152c892dcf63f445cbd7a"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__macros.html#gaa1dec568e79152c892dcf63f445cbd7a">ALWAYS_INLINE</a></td></tr>
<tr class="memdesc:gaa1dec568e79152c892dcf63f445cbd7a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Always enable inlining for one function.  <a href="#gaa1dec568e79152c892dcf63f445cbd7a">More...</a><br/></td></tr>
<tr class="separator:gaa1dec568e79152c892dcf63f445cbd7a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa1394a41d43c0f3fd30febe41c7bb340"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__macros.html#gaa1394a41d43c0f3fd30febe41c7bb340">arraysize</a>(a)</td></tr>
<tr class="separator:gaa1394a41d43c0f3fd30febe41c7bb340"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga8a15779356736a0900a162442b1cda53"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__macros.html#ga8a15779356736a0900a162442b1cda53">ASSERT</a>(_x)</td></tr>
<tr class="memdesc:ga8a15779356736a0900a162442b1cda53"><td class="mdescLeft">&#160;</td><td class="mdescRight">Runtime debug assertion.  <a href="#ga8a15779356736a0900a162442b1cda53">More...</a><br/></td></tr>
<tr class="separator:ga8a15779356736a0900a162442b1cda53"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad346cd2ed2f73697fa42a3445cf2fc57"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__macros.html#gad346cd2ed2f73697fa42a3445cf2fc57">CUBE_ALLOCATION</a>&#160;&#160;&#160;12</td></tr>
<tr class="memdesc:gad346cd2ed2f73697fa42a3445cf2fc57"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compile-time cube limit for the current application.  <a href="#gad346cd2ed2f73697fa42a3445cf2fc57">More...</a><br/></td></tr>
<tr class="separator:gad346cd2ed2f73697fa42a3445cf2fc57"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab11c3e92066a46e1e434390342dc6dc4"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__macros.html#gab11c3e92066a46e1e434390342dc6dc4">DEBUG_ONLY</a>(_x)</td></tr>
<tr class="memdesc:gab11c3e92066a46e1e434390342dc6dc4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Mark a chunk of code as debug-only.  <a href="#gab11c3e92066a46e1e434390342dc6dc4">More...</a><br/></td></tr>
<tr class="separator:gab11c3e92066a46e1e434390342dc6dc4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3577749fb48d57a158b8ac1a0b3ab57e"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__macros.html#ga3577749fb48d57a158b8ac1a0b3ab57e">LOG</a>(...)</td></tr>
<tr class="memdesc:ga3577749fb48d57a158b8ac1a0b3ab57e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Smart printf-like logging macro.  <a href="#ga3577749fb48d57a158b8ac1a0b3ab57e">More...</a><br/></td></tr>
<tr class="separator:ga3577749fb48d57a158b8ac1a0b3ab57e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga801ac093b3e12625755b3656ce2c54ad"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__macros.html#ga801ac093b3e12625755b3656ce2c54ad">LOG_FLOAT</a>(_x)</td></tr>
<tr class="separator:ga801ac093b3e12625755b3656ce2c54ad"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaafc5acca82ff227626a6c3260c591c01"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__macros.html#gaafc5acca82ff227626a6c3260c591c01">LOG_FLOAT2</a>(_x)</td></tr>
<tr class="separator:gaafc5acca82ff227626a6c3260c591c01"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gadc875eb3eb79fc8c2e13d2e0d01dba41"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__macros.html#gadc875eb3eb79fc8c2e13d2e0d01dba41">LOG_HEX</a>(_x)</td></tr>
<tr class="separator:gadc875eb3eb79fc8c2e13d2e0d01dba41"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga47e5e84e4b509348b9e698ae66d26b24"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__macros.html#ga47e5e84e4b509348b9e698ae66d26b24">LOG_INT</a>(_x)</td></tr>
<tr class="separator:ga47e5e84e4b509348b9e698ae66d26b24"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa2ee1d85abe881cd5cadf139e4b2b97c"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__macros.html#gaa2ee1d85abe881cd5cadf139e4b2b97c">LOG_INT2</a>(_x)</td></tr>
<tr class="separator:gaa2ee1d85abe881cd5cadf139e4b2b97c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad26bde916bcbd6ccee7241b259b5c1ff"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__macros.html#gad26bde916bcbd6ccee7241b259b5c1ff">LOG_INT3</a>(_x)</td></tr>
<tr class="separator:gad26bde916bcbd6ccee7241b259b5c1ff"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga1716eab95281fd24d5176df9633f31f7"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__macros.html#ga1716eab95281fd24d5176df9633f31f7">LOG_STR</a>(_x)</td></tr>
<tr class="separator:ga1716eab95281fd24d5176df9633f31f7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gafa99ec4acc4ecb2dc3c2d05da15d0e3f"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__macros.html#gafa99ec4acc4ecb2dc3c2d05da15d0e3f">MAX</a>(a, b)</td></tr>
<tr class="separator:gafa99ec4acc4ecb2dc3c2d05da15d0e3f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3acffbd305ee72dcd4593c0d8af64a4f"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__macros.html#ga3acffbd305ee72dcd4593c0d8af64a4f">MIN</a>(a, b)</td></tr>
<tr class="separator:ga3acffbd305ee72dcd4593c0d8af64a4f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga1b173d22e57d9395897acbd8de62d505"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__macros.html#ga1b173d22e57d9395897acbd8de62d505">NOINLINE</a></td></tr>
<tr class="memdesc:ga1b173d22e57d9395897acbd8de62d505"><td class="mdescLeft">&#160;</td><td class="mdescRight">Disable automatic inlining for one function.  <a href="#ga1b173d22e57d9395897acbd8de62d505">More...</a><br/></td></tr>
<tr class="separator:ga1b173d22e57d9395897acbd8de62d505"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga070d2ce7b6bb7e5c05602aa8c308d0c4"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__macros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a></td></tr>
<tr class="separator:ga070d2ce7b6bb7e5c05602aa8c308d0c4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gafef9199621fafa1bd046611921ab061f"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__macros.html#gafef9199621fafa1bd046611921ab061f">offsetof</a>(t, m)</td></tr>
<tr class="separator:gafef9199621fafa1bd046611921ab061f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga7a08279d8529b1eb2d374ee61f50849c"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__macros.html#ga7a08279d8529b1eb2d374ee61f50849c">SCRIPT</a>(_type, _code)</td></tr>
<tr class="memdesc:ga7a08279d8529b1eb2d374ee61f50849c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Inline emulator scripting, for automated testing and more.  <a href="#ga7a08279d8529b1eb2d374ee61f50849c">More...</a><br/></td></tr>
<tr class="separator:ga7a08279d8529b1eb2d374ee61f50849c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaae31453655b2aac2b521a9e198a78863"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__macros.html#gaae31453655b2aac2b521a9e198a78863">SCRIPT_FMT</a>(_type,...)</td></tr>
<tr class="memdesc:gaae31453655b2aac2b521a9e198a78863"><td class="mdescLeft">&#160;</td><td class="mdescRight">Like <a class="el" href="group__macros.html#ga7a08279d8529b1eb2d374ee61f50849c" title="Inline emulator scripting, for automated testing and more.">SCRIPT()</a>, but this variant supports format specifiers.  <a href="#gaae31453655b2aac2b521a9e198a78863">More...</a><br/></td></tr>
<tr class="separator:gaae31453655b2aac2b521a9e198a78863"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga7edd81981ef063a2fa8effde7a2ba341"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__macros.html#ga7edd81981ef063a2fa8effde7a2ba341">SCRIPT_TYPE</a>(_type)</td></tr>
<tr class="separator:ga7edd81981ef063a2fa8effde7a2ba341"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga9e056034457296a234feb86b4d570330"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__macros.html#ga9e056034457296a234feb86b4d570330">SRCLINE</a></td></tr>
<tr class="separator:ga9e056034457296a234feb86b4d570330"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga83608df0f7c42773fdb6030debad2f60"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__macros.html#ga83608df0f7c42773fdb6030debad2f60">STATIC_ASSERT</a>(_x)</td></tr>
<tr class="separator:ga83608df0f7c42773fdb6030debad2f60"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga553fd78d953bb49d274c689f6f483004"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__macros.html#ga553fd78d953bb49d274c689f6f483004">STRINGIFY</a>(_x)</td></tr>
<tr class="separator:ga553fd78d953bb49d274c689f6f483004"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga5cb0f8e744cc03a12d0e60ad3f936a57"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__macros.html#ga5cb0f8e744cc03a12d0e60ad3f936a57">TOSTRING</a>(_x)</td></tr>
<tr class="memdesc:ga5cb0f8e744cc03a12d0e60ad3f936a57"><td class="mdescLeft">&#160;</td><td class="mdescRight">A second-level wrapper around the C preprocessor stringification operator.  <a href="#ga5cb0f8e744cc03a12d0e60ad3f936a57">More...</a><br/></td></tr>
<tr class="separator:ga5cb0f8e744cc03a12d0e60ad3f936a57"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>Utility, logging, and scripting macros. </p>
<p>This section includes common C++ utility macros, as well as macros which implement platform-specific logging and debugging support. </p>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a class="anchor" id="gaa1dec568e79152c892dcf63f445cbd7a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define ALWAYS_INLINE</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Always enable inlining for one function. </p>
<p>For example: </p>
<pre class="fragment">void ALWAYS_INLINE myFunction() {
    // Must be inlined
}
</pre><p>This attribute may be useful in cases where a function would normally not be inlined, but for either performance or correctness reasons you need it to be. Inlined functions are just as fast as macros. </p>

</div>
</div>
<a class="anchor" id="gaa1394a41d43c0f3fd30febe41c7bb340"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define arraysize</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">a</td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Calculate the number of elements in a C++ array, using sizeof. </p>

</div>
</div>
<a class="anchor" id="ga8a15779356736a0900a162442b1cda53"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define ASSERT</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">_x</td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Runtime debug assertion. </p>
<p>On release builds, ASSERT has no effect. On debug builds, the argument is evaluated, and if it is False, the current program aborts with an Abort fault, after logging the text of the failed test, along with the line number and file where it occurred.</p>
<p>Normally you would disable ASSERT by linking your binary as a release build. However, sometimes it can be useful to have a build with symbols but without assertions. For example, this can be used to isolate problems that, for whatever reason, only show up with assertions disabled. You can do this by setting the -DNO_ASSERT compiler option. </p>

</div>
</div>
<a class="anchor" id="gad346cd2ed2f73697fa42a3445cf2fc57"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define CUBE_ALLOCATION&#160;&#160;&#160;12</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Compile-time cube limit for the current application. </p>
<p>These SDK headers use CUBE_ALLOCATION to size many internal arrays, such as the array of loading FIFOs in AssetLoader, or the array of base addresses in an AssetGroup. You</p>
<p>Every game can individually define a compile-time limit for the number of supported cubes, by supplying their own value for CUBE_ALLOCATION in their Makefile or with a preprocessor definition that is always included above the SDK headers.</p>
<p>It must be less than or equal to the firmware limit of 24. Many data structures are statically allocated using this number, so if a game is running low on RAM it can decrease the limit, or if it needs more cubes it can be increased. </p>

</div>
</div>
<a class="anchor" id="gab11c3e92066a46e1e434390342dc6dc4"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define DEBUG_ONLY</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">_x</td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Mark a chunk of code as debug-only. </p>
<p>This code will be disabled at link-time on release builds. For example: </p>
<pre class="fragment">DEBUG_ONLY(doDebugStuff());

DEBUG_ONLY({
    // Do some inlined debug stuff here.
});
</pre><p>This macro acts like a C statement, and it may include any C statement or block. The supplied code is <em>not</em> removed at compile-time, so any compile-time side effects (such as using the value of a variable) always occur. The argument is wrapped in a _SYS_lti_isDebug() test. This function evaluates to either true or false at link-time. So, at link-time, if the <code>-g</code> flag was not passed to Slinky, the enclosed code is optimized out. </p>

</div>
</div>
<a class="anchor" id="ga3577749fb48d57a158b8ac1a0b3ab57e"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define LOG</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>...</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Smart printf-like logging macro. </p>
<p>This macro acts like printf(), but with some important differences:</p>
<ul>
<li>Most but not all standard format specifiers are supported.</li>
<li>Many new format specifiers are available, as listed below.</li>
<li>Like the DEBUG_ONLY macro, these macros always generate code at compile-time, but they are fully optimized out at link-time when linking a release binary.</li>
<li>Any parameters which are known to be constant at link-time are expanded right away, and no corresponding code is generated. This also means that string literals inserted with <code>%s</code> behave exactly the same as if the corresponding string had been escaped properly and included as part of the format string.</li>
</ul>
<p>In fact, the linker does a lot of work to support these logging macros in the most efficient way possible. The format string is parsed by Slinky, and a sequence of logging <em>packets</em> are generated. These log packets may contain raw binary data (for strings, hex dumps) or they may contain a set of unformatted printf()-like parameters, along with a reference to a format string in an external string table.</p>
<p>The format string is <em>not stored</em> in your game's read-only data segment. Instead, it is part of your game's debug symbols. This means that when running a debug build on real hardware, the format strings never have to be installed on the Base. Instead, your PC uses the binary's debug symbols to decode very terse un-formatted log packets back into the full text output.</p>
<p>Normally you would disable debugging by linking your binary as a release build. However, sometimes it can be useful to have a build with symbols but without LOGs. For example, this can be used to isolate problems that, for whatever reason, only show up with LOGs disabled. You can do this by setting the -DNO_LOG compiler option.</p>
<p>Logging supports a variety of format specifiers. Most of the standard printf() specifiers are supported, plus we have several new ones:</p>
<ul>
<li>Literal characters, and <code>%%</code></li>
<li>Standard integer specifiers: <code>%d, %i, %o, %u, %X, %x, %p, %c</code></li>
<li>Standard float specifiers: <code>%f, %F, %e, %E, %g, %G</code></li>
<li>Four chars packed into a 32-bit integer: <code>%C</code></li>
<li>Binary integers: <code>%b</code></li>
<li>C-style strings: <code>%s</code></li>
<li>Hex-dump of fixed width buffers: <code>%(width in bytes)h</code></li>
<li>Pointer, printed as a resolved symbol when possible: <code>%P</code></li>
</ul>
<dl class="section note"><dt>Note</dt><dd>In the siftulator, <a class="el" href="group__macros.html#ga3577749fb48d57a158b8ac1a0b3ab57e" title="Smart printf-like logging macro.">LOG()</a> will write to your console or terminal. In order to access <a class="el" href="group__macros.html#ga3577749fb48d57a158b8ac1a0b3ab57e" title="Smart printf-like logging macro.">LOG()</a> output on hardware, see the <b>Logging</b> section in the <a class="el" href="device_mgmt.html">Device Management</a> guide. </dd></dl>

</div>
</div>
<a class="anchor" id="ga801ac093b3e12625755b3656ce2c54ad"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define LOG_FLOAT</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">_x</td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Convenience macro for tracing the name and value of a floating point expression </p>

</div>
</div>
<a class="anchor" id="gaafc5acca82ff227626a6c3260c591c01"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define LOG_FLOAT2</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">_x</td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Convenience macro for tracing the name and value of a floating point 2-vector expression </p>

</div>
</div>
<a class="anchor" id="gadc875eb3eb79fc8c2e13d2e0d01dba41"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define LOG_HEX</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">_x</td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Convenience macro for tracing the name and value of an expression, in hexadecimal </p>

</div>
</div>
<a class="anchor" id="ga47e5e84e4b509348b9e698ae66d26b24"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define LOG_INT</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">_x</td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Convenience macro for tracing the name and value of an integer expression </p>

</div>
</div>
<a class="anchor" id="gaa2ee1d85abe881cd5cadf139e4b2b97c"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define LOG_INT2</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">_x</td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Convenience macro for tracing the name and value of an integer 2-vector expression </p>

</div>
</div>
<a class="anchor" id="gad26bde916bcbd6ccee7241b259b5c1ff"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define LOG_INT3</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">_x</td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Convenience macro for tracing the name and value of an integer 3-vector expression </p>

</div>
</div>
<a class="anchor" id="ga1716eab95281fd24d5176df9633f31f7"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define LOG_STR</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">_x</td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Convenience macro for tracing the name and value of a C-style string </p>

</div>
</div>
<a class="anchor" id="gafa99ec4acc4ecb2dc3c2d05da15d0e3f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define MAX</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">a, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">b&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Macro which returns the largest of two values. Values are evaluated twice. </p>

</div>
</div>
<a class="anchor" id="ga3acffbd305ee72dcd4593c0d8af64a4f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define MIN</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">a, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">b&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Macro which returns the smallest of two values. Values are evaluated twice. </p>

</div>
</div>
<a class="anchor" id="ga1b173d22e57d9395897acbd8de62d505"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define NOINLINE</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Disable automatic inlining for one function. </p>
<p>For example: </p>
<pre class="fragment">void NOINLINE myFunction() {
    // Won't be inlined
}
</pre><p>This attribute may be useful in cases where you want to explicitly prevent a function's code from being included into its callers, for debugging or for cache optimization reasons. </p>

</div>
</div>
<a class="anchor" id="ga070d2ce7b6bb7e5c05602aa8c308d0c4"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define NULL</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Invalid pointer. Equal to zero. </p>

</div>
</div>
<a class="anchor" id="gafef9199621fafa1bd046611921ab061f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define offsetof</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">t, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">m&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Calculate the byte offset from the beginning of structure <code>t</code> to member <code>m</code> </p>

</div>
</div>
<a class="anchor" id="ga7a08279d8529b1eb2d374ee61f50849c"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define SCRIPT</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">_type, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">_code&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Inline emulator scripting, for automated testing and more. </p>
<p>Scripting is a feature available only when running debug builds in Siftulator. All inline scripting is removed at link-time when building a Release binary.</p>
<p>This macro runs the specified 'code' in Siftulator's scripting environment. 'type' indicates which scripting language/environment the code is intended for. Right now the only supported type is <code>LUA</code>.</p>
<p>For example: </p>
<pre class="fragment">SCRIPT(LUA,
    package.path = package.path .. ";scripts/?.lua"
    require('my-test-library')
);

SCRIPT(LUA, invokeTest());

SCRIPT(LUA, System():setAssetLoaderBypass(true));

SCRIPT(LUA, Cube(0):saveScreenshot("myScreenshot.png"));

SCRIPT(LUA, Cube(0):testScreenshot("myScreenshot.png"));
</pre><p>These script fragments are all executed in the same global Lua context. Each script fragment executes synchronously with your game code.</p>
<p>See the <a class="el" href="scripting.html">Scripting</a> documentation for more info. </p>

</div>
</div>
<a class="anchor" id="gaae31453655b2aac2b521a9e198a78863"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define SCRIPT_FMT</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">_type, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>...</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Like <a class="el" href="group__macros.html#ga7a08279d8529b1eb2d374ee61f50849c" title="Inline emulator scripting, for automated testing and more.">SCRIPT()</a>, but this variant supports format specifiers. </p>
<p>This can be used to pass parameters back and forth between Lua code and your game's code, when running in Siftulator.</p>
<p>For example: </p>
<pre class="fragment">SCRIPT_FMT(LUA, "Frontend():postMessage('Power is &gt;= %d')", 9000);

int luaGetInteger(const char *expr)
{
    int result;
    SCRIPT_FMT(LUA, "Runtime():poke(%p, %s)", &amp;result, expr);
    return result;
}

void luaSetInteger(const char *varName, int value)
{
    SCRIPT_FMT(LUA, "%s = %d", varName, value);
}
</pre><p>This is implemented using the same formatter as <a class="el" href="group__macros.html#ga3577749fb48d57a158b8ac1a0b3ab57e" title="Smart printf-like logging macro.">LOG()</a>, so all of the format specifiers and features described in <a class="el" href="group__macros.html#ga3577749fb48d57a158b8ac1a0b3ab57e" title="Smart printf-like logging macro.">LOG()</a>'s documentation apply to <a class="el" href="group__macros.html#gaae31453655b2aac2b521a9e198a78863" title="Like SCRIPT(), but this variant supports format specifiers.">SCRIPT_FMT()</a> as well. </p>

</div>
</div>
<a class="anchor" id="ga7edd81981ef063a2fa8effde7a2ba341"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define SCRIPT_TYPE</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">_type</td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This macro is used as part of the implementation of <a class="el" href="group__macros.html#ga7a08279d8529b1eb2d374ee61f50849c" title="Inline emulator scripting, for automated testing and more.">SCRIPT()</a> and <a class="el" href="group__macros.html#gaae31453655b2aac2b521a9e198a78863" title="Like SCRIPT(), but this variant supports format specifiers.">SCRIPT_FMT()</a>, but it may also be useful on its own in special circumstances.</p>
<p>This macro sets the current scripting backend which receives log messages. If the scripting backend is set to <code>NONE</code>, <a class="el" href="group__macros.html#ga3577749fb48d57a158b8ac1a0b3ab57e" title="Smart printf-like logging macro.">LOG()</a> messages behave normally. If a different scripting engine is specified, however, fully formatted <a class="el" href="group__macros.html#ga3577749fb48d57a158b8ac1a0b3ab57e" title="Smart printf-like logging macro.">LOG()</a> text is accumulated in a buffer in Siftulator until such time as the scripting backend is set back to <code>NONE</code>. At that moment, the scripting backend has a chance to synchronously interpret the buffer of logged text. </p>

</div>
</div>
<a class="anchor" id="ga9e056034457296a234feb86b4d570330"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define SRCLINE</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Expands to a string literal uniquely identifying the file and source line where it appears. </p>

</div>
</div>
<a class="anchor" id="ga83608df0f7c42773fdb6030debad2f60"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define STATIC_ASSERT</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">_x</td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Produces a 'size of array is negative' compile error when the assert fails </p>

</div>
</div>
<a class="anchor" id="ga553fd78d953bb49d274c689f6f483004"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define STRINGIFY</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">_x</td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>A macro wrapper for the C preprocessor stringification operator. </p>

</div>
</div>
<a class="anchor" id="ga5cb0f8e744cc03a12d0e60ad3f936a57"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define TOSTRING</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">_x</td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>A second-level wrapper around the C preprocessor stringification operator. </p>
<p>Necessary if you wish to stringify tokens after macro expansion rather than before. </p>

</div>
</div>
</div><!-- contents -->
<!-- HTML footer for doxygen 1.8.3.1-->
<!-- start footer part -->
    <hr class="footer"/>
    <address class="footer">
        <p><a href="http://sifteo.com">Sifteo</a> SDK v1.0.0 <small>(see <a href="https://developers.sifteo.com/sifteosdk">all versions</a>)</small></p>
        <p>Last updated Wed Mar 27 2013, by <a href="http://www.stack.nl/~dimitri/doxygen">Doxygen</a></p>
    </address>
</body>
</html>
